"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const HttpServer = require("http");
const express = require("express");
const bodyParser = require("body-parser");
const path = require("path");
const SocketIO = require("socket.io");
class WebServer {
    constructor(port) {
        this.webRoot = path.join(__dirname, '/web');
        this.socketRequestMap = new Map();
        const app = express();
        app.use(bodyParser.json());
        app.use(bodyParser.urlencoded({ extended: false }));
        app.use(express.static(this.webRoot));
        this.http = HttpServer.createServer(app);
        this.io = SocketIO(this.http);
        this.io.on('connection', socket => {
            socket.on('request', (request) => {
                this.socketRequestMap.set(request.id, socket);
            });
        });
    }
}
exports.default = WebServer;
